<template>
  <router-link 
    :to="`/tech/${tech.id}`" 
    class="tech-card"
    :aria-label="`了解更多关于${tech.title}的信息`"
    role="article"
  >
    <div class="card-header" :style="{ background: tech.gradient }">
      <div class="tech-icon" aria-hidden="true">{{ tech.icon }}</div>
    </div>
    
    <div class="card-body">
      <h3>{{ tech.title }}</h3>
      <p class="description">{{ tech.shortDesc }}</p>
      
      <div class="tech-tags" role="list" aria-label="相关技术">
        <span 
          v-for="tag in tech.technologies.slice(0, 3)" 
          :key="tag" 
          class="tag"
          role="listitem"
        >
          {{ tag }}
        </span>
      </div>
      
      <div class="card-footer">
        <span class="learn-more">
          了解更多 
          <span class="arrow" aria-hidden="true">→</span>
        </span>
      </div>
    </div>
  </router-link>
</template>

<script setup>
defineProps({
  tech: {
    type: Object,
    required: true
  }
})
</script>

<style scoped>
.tech-card {
  background: var(--dark-surface-light);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--duration-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* 霓虹边框效果 */
.tech-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-accent);
  background-size: 400% 400%;
  border-radius: var(--radius-xl);
  opacity: 0;
  z-index: var(--z-negative);
  transition: opacity var(--duration-slow) ease;
  animation: gradient-flow 8s ease infinite;
}

/* Usar gradient-flow de style.css */

.tech-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
  pointer-events: none;
}

.tech-card:hover::before {
  opacity: 1;
}

.tech-card:hover::after {
  left: 100%;
}

.tech-card:hover {
  transform: translateY(-12px) rotateX(2deg) scale(1.02);
  box-shadow: 
    0 25px 50px rgba(99, 102, 241, 0.4),
    0 0 60px rgba(99, 102, 241, 0.3),
    inset 0 0 30px rgba(99, 102, 241, 0.05);
  border-color: var(--neon-purple);
}

.card-header {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  animation: rotate 15s linear infinite;
}

.card-header::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.tech-card:hover .card-header::after {
  width: 200%;
  height: 200%;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tech-icon {
  font-size: 4rem;
  z-index: 1;
  animation: float 3s ease-in-out infinite;
  transition: all 0.5s ease;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
}

.tech-card:hover .tech-icon {
  transform: scale(1.2) rotateZ(5deg);
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.6));
}

.card-body {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  color: var(--text-primary);
  font-size: var(--font-2xl);
  margin-bottom: var(--space-sm);
  font-weight: 700;
  transition: all var(--duration-normal) ease;
  position: relative;
  letter-spacing: 0.01em;
}

.tech-card:hover .card-body h3 {
  color: var(--neon-blue);
  text-shadow: 0 0 20px rgba(0, 243, 255, 0.8);
}

.description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.8;
  flex: 1;
  font-size: 1.05rem;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background: rgba(99, 102, 241, 0.2);
  color: var(--neon-blue);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.tech-card:hover .tag {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--neon-purple);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.tech-card:hover .tag::before {
  left: 100%;
}

.card-footer {
  margin-top: auto;
}

.learn-more {
  color: var(--primary-color);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: gap 0.3s ease;
}

.tech-card:hover .learn-more {
  gap: 1rem;
}

.arrow {
  transition: transform 0.3s ease;
}

.tech-card:hover .arrow {
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .card-body h3 {
    font-size: 1.2rem;
  }
  
  .tech-icon {
    font-size: 3rem;
  }
}
</style>

